/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package halali;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
import moviedownloader5.DataSourceProvider;

/**
 *
 * @author martin100
 */
public class RelationSaverImpl implements RelationSaver {

    private final DataSource ds;
    private final Connection conn;

    public RelationSaverImpl() {
        this.ds = DataSourceProvider.getDataSource();
        try {
            conn = ds.getConnection();
            conn.setAutoCommit(true);
        } catch (SQLException ex) {
            throw new IllegalArgumentException(ex);
        }

    }

    @Override
    public void saveRelation(int showId, int csfdMovieId) {
       
        System.out.println("match movie:"+csfdMovieId+ "show:"+showId);
        
        /*try {
            Statement show_statement = conn.createStatement();
            show_statement.executeQuery("update show set film_id = " + csfdMovieId + " where show_id = " + showId);

        } catch (SQLException ex) {
        }*/

    }

}
